Как создать натив на выдачу оружия в CS 1.6?
Как создать натив на выдачу оружия в CS 1.6?

Все чаще и чаще вижу в разных группах подобный вопрос "как добавить натив в extra item", в данной статье я попробую подробно рассказать как добавить натив в любую пушку!

Начнём с того, что мы скачаем любой плагин оружия для Zombie Plague 4.3 (и выше).

У меня будет на примере оружие Petrol Boomer от Dias'a. Скачать плагин можно от сюда: https://tb-team.com/counter-strike/zombie-plague/extra_items/971-zp-extra-item-petrol-boomer.html.

Для того, чтобы сделать натив, нам нужна функция выдачи оружия, а так как оружие для Zombie Plague 4.3, значит оно автоматически будет добавляться в Extra-Items. Это нам упростит задачу.

1. Ищем функцию zp_extra_item_selected
public zp_extra_item_selected(id, itemid)
{
	if(itemid == g_pet) Get_PB(id)
}


2. Видим что после проверки на itemid идёт функция выдачи оружия: Get_PB(id)

3. Создаём натив
public plugin_natives()
{
	register_native("zp_give_user_petrolboomer", "Get_PB", 1);
}


Где zp_give_user_petrolboomer - это наш натив будет в сторонних плагинах
Где Get_PB - это название функции выдачи оружия



Однако, бывает так, что оружия выдаются не через отдельную функцию, а сразу же в zp_extra_item_selected написан весь код выдачи оружия. Наглядный вариант мы видим здесь: https://tb-team.com/counter-strike/zombie-plague/extra_items/538-zp-extra-item-m4a1-frost.html



1. Ищем также zp_extra_item_selected

public zp_extra_item_selected(player, itemid)
{
	if (itemid == g_iItemID) 
	{
		g_bHasFrostM4A1[player] = true
		ham_strip_weapon(player, "weapon_m4a1")
		give_item(player, "weapon_m4a1")
		cs_set_user_bpammo(player, CSW_M4A1, 90)
		new sName[32]
		get_user_name(player, sName, 31)
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
		show_hudmessage(0, "%s Купил Frost M4A1!", sName)
		ColorPrint(player, "^1[^4Zombie-Amxx.Ru^1] ^3Вы купили Frost M4A1^1!")
	}
}

2. Всё что идёт после if (itemid == g_iItemID) можно копировать, а именно этот код

g_bHasFrostM4A1[player] = true
ham_strip_weapon(player, "weapon_m4a1")
give_item(player, "weapon_m4a1")
cs_set_user_bpammo(player, CSW_M4A1, 90)
new sName[32]
get_user_name(player, sName, 31)
set_hudmessage(random(255), random(255), random(255), -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
show_hudmessage(0, "%s Купил Frost M4A1!", sName)
ColorPrint(player, "^1[^4Zombie-Amxx.Ru^1] ^3Вы купили Frost M4A1^1!")

3. Создаём функцию для выдачи данного оружия. У меня же это будет
public give_frost_m4(player)


Прошу заметить, что я указал player для индекса игрока, так как в выдаче оружия было указано player, а не id / iPlayer и тому подобное.
4. Вписываем в функцию то, что мы скопировали
public give_frost_m4(player)
{
	g_bHasFrostM4A1[player] = true
	ham_strip_weapon(player, "weapon_m4a1")
	give_item(player, "weapon_m4a1")
	cs_set_user_bpammo(player, CSW_M4A1, 90)
	new sName[32]
	get_user_name(player, sName, 31)
	set_hudmessage(random(255), random(255), random(255), -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
	show_hudmessage(0, "%s Купил Frost M4A1!", sName)
	ColorPrint(player, "^1[^4Zombie-Amxx.Ru^1] ^3Вы купили Frost M4A1^1!")
}


5. Ну и теперь создаём сам натив
public plugin_natives()
{
	register_native("zp_give_user_frostm4", "give_frost_m4", 1);
}



Ну и теперь нам осталось добавить данные нативы например в VIP меню.


1.Открываем VIP меню и в начале плагина, вписываем данный код
native zp_give_user_petrolboomer(iPlayer);
native zp_give_user_frostm4(iPlayer);

2. Ну и идём туда, где вы будете выдавать само оружие и прописываете один из нужных вам нативов. Обязательно с указанием правильного индекса игрока.
На этом всё, если у кого то есть желания отблагодарить автора за столь полезную статью, то кнопка ниже

Hello, our administration publishes only cannon content, put like under the post below and write the best comment, we are preparing material just for you, Darling Гость.

Donate you can do to the author xUnicorn, a gift in the form of a donation to his electronic piggy bank ;)


Comments 6
Информация
Посетители, находящиеся в группе Guests, не могут оставлять комментарии к данной публикации.
Our Discord partners
Foundation for your build
ReHLDS 3.4.0.654

ReHLDS (Reverse-engineered) - this is a new step forward that gives a second wind to our servers. ReHLDS works 2 times faster than HLDS.

AmxModx 1.8.3

AMXModX is a Metamod add-on that allows you to create new modifications for Half-Life in the Pawn language

Reunion 0.1.92

Reunion is a continuation of Dproto for ReHLDS. This is a metamod plugin that allows you to log into the 47/48 Non-Steam server.

Revoice 0.1.0.32

Revoice is a Metamod plugin that allows voice chat between non-steam and steam clients.

Metamod-r 1.3.0.127

The new Metamod-r contains a huge number of performance optimizations and much cleaner code. The kernel was written using a JIT compiler.

Ultimate Unprecacher 1.1

Ultimate Unprecacher is a plugin for MetaMod, it works on the principle of disabling unnecessary resources on your server, thereby you can free up space for resources for your plugins, using this module you can get rid of error 512!

ReAuthCheck 0.1.6

ReAuthCheck - this is a Metamod plugin that checks your players for validity, with this module for REHLDS you can protect your server from bots that constantly spam ads or simply clog up a slot on the server!

NetBufExtender (NBEX) 1.0

NetBufExtender or NBEX - This is a metamod plugin that expands the пїЅInternet bufferпїЅ: server and client buffers (not 100% guaranteed). Expands up to 64 kb. This means that players are less likely to be kicked with the error "Reliable channel overflowed"".

UserInfoNetOptimizer (UINO) 1.0

UINO пїЅ metamod plugin that allows you to remove unnecessary fields from userinfo(setinfo) when the engine passes it to other players on the server. This measure reduces the amount of data transferred and slightly reduces the chance of being kicked with "Reliable channel overflowed".

Information

Welcome to TB-TEAM.COM!

Welcome To Our New Website For CS1.6 Resources!.
Register
Create your own account!

Register Now!
Login
Already registered? Come on, log in quickly!

Login to the site